package bairui.international.weixin.portal.miniapp.controller.custom.custom;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lianjing.sh.model.uml.model.status.State_UpDown;
import com.lianjing.sh.spring.web.controller.base.action.Action;
import com.lianjing.sh.spring.web.controller.enhance.output.FomatOutput;

import bairui.international.model.domain.jpa.TB_Custom;
import bairui.international.service.Service_Custom;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 *
 * 获取
 *
 * @generated
 * 
 * @see STest_C_Custom_Get_Get 测试
 *
 */
@Controller
public class C_Custom_Get_Get
 extends SC_Custom_Get_Get 
{
	
	@Autowired private Service_Custom service_Custom;
	
	/**
	 * Get请求
	 */
	@Action(Get.class)
	@GetMapping(Get.RequestMappingValue)
	public @FomatOutput @ResponseBody Object get(
		ModelMap map, HttpServletRequest request
	) throws Exception {
		TB_Custom bean = service_Custom.findFirst(it->it.state.eq(State_UpDown.Uped));
		if(null == bean){
			return new Output();
		}
		return new Output(bean.getContent());
	}
	
	@NoArgsConstructor
	@AllArgsConstructor
	private class Output {
		@Getter private String content;
	}

}
